{extend name="default/base" /}
{block name="title"}商品列表 -{:WSTConf('CONF.shopName')}{__block__}{/block}
{block name="meta"}
<meta name="description" content="{:WSTConf('CONF.seoShopDesc')}">
<meta name="Keywords" content="{:WSTConf('CONF.seoShopKeywords')}">
{/block}
{block name="css"}
<link href="__STYLE__/css/goodslist.css?v={$v}" rel="stylesheet">
{/block}
{block name="nav"}
	{include file="default/header" /}
{/block}
{block name="main"}
{/* 已筛选的条件 */}
<input type="hidden" id="cat" class="sipt" value='{$catId}'/>
<input type="hidden" id="brand" class="sipt" value='{$brandId}'/>
{volist name="$vs" id="v"}
<input type="hidden" id="v_{$v}" class="sipt" value='{$attrs["v_".$v]}'/>
{/volist}
<input type="hidden" id="vs" class="sipt" value='{:implode(",",$vs)}'/>
<input type="hidden" id="orderBy" class="sipt" value='{$orderBy}'/>
<input type="hidden" id="order" class="sipt" value='{php}echo ($order=="0")?"1":"0";{/php}' autocomplete="off"/>
<input type="hidden" id="goodsName" class="sipt" value='{$goodsName}' autocomplete="off"/>
<div class='wst-filters'>
   <div class='item' style="border-left:2px solid #df2003;padding-left: 8px;">
      <a class='link' href='__ROOT__'>首页</a>
      <i class="arrow">></i>
   </div>
   {if($catId)}
   {volist name=":WSTPathGoodsCat($catId)" id='vo'}
   <div class='wst-lfloat'>
   	<div class='item dorpdown'>
     <div class='drop-down'>
     	{php}$cId=$vo['catId']{/php}
        <a class='link' href='__ROOT__'>{$vo['catName']}</a>
        <i class="drop-down-arrow"></i>
     </div>
     <div class="dorp-down-layer">
         {volist name=":WSTGoodsCats($vo['parentId'])" id='vo2'}
         <div class="{$vo['parentId']>0?'cat2':'cat1'}"><a href='{:Url("home/goods/lists","cat=".$vo2["catId"])}'>{$vo2['catName']}</a></div>
         {/volist}
	</div>
	</div>
   </div>
  
   {/volist}
   {volist name="$selector" id='vo'}
   <div class='item dorpdown'>
   <a class='v-item' href='javascript:void(0);' onclick="javscript:removeFilter('{$vo['type']}')">
     <span>{$vo['label']}：{$vo['val']}</span>
     <i>x</i>
   </a>
   <i class="arrow">></i>
   </div>
   {/volist}
   {else}
   <div class='item'>
      <a class='link' href='javascript:void(0);'>全部商品分类</a>
   </div>
   {/if}
   <div class="filter-search">
   		<input type="text" placeholder="在此结果中搜索" id="sGoodsName" value="{if('' != $goodsName)}{$goodsName}{/if}"  />
   		<div class="fsearchIcon" onclick='javascript:fsGoods()'></div>
   	</div>
   <div class='wst-clear'></div>
</div>
<div style="width:1200px;margin:0 auto;">
	<div style="width:210px;height:337px;float:left;margin-top:10px;">
		<div class="catName">
			{$vo['catName']??'全部商品分类'}
		</div>
		<ul class="catNameItem">
		{volist name="$goodsCats" id="vo"}
			<a href="{:Url("home/goods/lists","cat=".$vo["catId"])}"><li>{:WSTMSubstr($vo['catName'],0,4)}</li></a>
		{/volist}
		</ul>
	</div>
	{/* 筛选条件  */}
	<div class="wst-selector" style="width:975px;float:left;padding-left:10px;">
		{/* 推荐热卖   */}
		<div class="uc-goods-box" style="padding-top:0px;border: none;">
		<div class="wst-user-head"><span>热卖推荐</span></div>
			{wst:goods type='recom' cat='$catId' id="rec" num='5'}
			<div class="rnbh-goods" >
				<a class="rnbg-imgbox" href="{:Url("home/goods/detail","id=".$rec["goodsId"])}" target="_blank">
					<img class='goodsImg' data-original="__ROOT__/{:WSTImg($rec['goodsImg'])}"  title="{$rec['goodsName']}"/>
				</a>
				<p class="rnbh-goodsName">
					<a href='{:Url("home/goods/detail","id=".$rec["goodsId"])}' target='_blank'>
						{$rec['goodsName']}
					</a>
				</p>
				<div class="rnbh-goodsInfo">
					<span class="rnbh-goodsprice">￥{$rec['shopPrice']}</span>
					<span class="rnbh-goodssale">成交量：<em>{$rec['saleNum']}</em></span>
				</div>
				<a class="rnbh-addcart" href="javascript:WST.addCart({$rec['goodsId']});" >加入购物车</a>
			</div>
			{/wst:goods}
		</div>
		{/* 推荐热卖end   */}

	    <div class='head'>商品筛选条件</div>
	    <div class="main">
	       {php}$selectorNum = 0;{/php}
	       {if !empty($brandFilter)}
	       {php}$selectorNum++;{/php}
	       <div class='item'>
	          <div class='label'>品牌：</div>
	          <ul class='content'>
	          {volist name="$brandFilter" id="bv"}
	          <li class='s-item' onclick='javascript:goodsFilter(this,1)' v="{$bv['brandId']}">{$bv['brandName']}</li>
	          {/volist}
	          </ul>
	          <div class='extra'>&nbsp;</div>
	          <div class='wst-clear'></div>
	       </div>
	       {/if}
	       {volist name="$goodsFilter" id="gv"}
	       {php}$selectorNum++;{/php}
	       <input type="hidden" id="v_{$gv['attrId']}" class="sipt" value=''/>
	       <div class='item <?=($selectorNum > 3)?"hideItem hide":"" ?>'>
	          <div class='label'>{$gv['attrName']}：</div>
	          <ul class='content'>
	             {volist name="$gv['attrVal']" id="gvi"}
	             <li class='s-item' onclick='javascript:goodsFilter(this,3)' d="{$gv['attrId']}" v="{$gvi}">{$gvi}</li>
	             {/volist}
	          </ul>
	          <div class='extra'>&nbsp;</div>
	          <div class='wst-clear'></div>
	       </div>
	       {/volist}
	       {php}$selectorNum++;{/php}
	       {if $sprice=='' && $eprice==''}
	       <div class='item <?=($selectorNum > 3)?"hideItem hide":"" ?>'>
	          <div class='label'>价格：</div>
	          <ul class='content'>
	          {volist name='priceGrade' id='vo' key="pKey" }
	          <li class='s-item' onclick='javascript:goodsFilter(this,2)' v="{$key}">{$vo}</li>
	          {/volist}
	          </ul>
	          <div class='extra'>&nbsp;</div>
	          <div class='wst-clear'></div>
	       </div>
	       {/if}
	       {if $selectorNum > 3}
	       <div class="item-more-box">
	          <div class='item-more' v="1"><span>更多选项</span><i class="drop-down"></i></div>
	       </div>
	       {/if}
	    </div>
	    <div class='wst-clear'></div>
	</div>
</div>

{/* 商品展示  */}
<div class="wst-container">
	<div class='goods-side'>
		<div class="guess-like">
			<div class="title">猜你喜欢</div>
			{wst:goods type='best' cat="$catId" num='3'}
			<div class="item">
				<div class="img"><a target='_blank' href="{:Url('home/goods/detail','id='.$vo['goodsId'])}"><img class='goodsImg' data-original="__ROOT__/{:WSTImg($vo['goodsImg'])}" alt="{$vo['goodsName']}" title="{$vo['goodsName']}"/></a></div>
				<div class="p-name"><a class="wst-hide wst-redlink">{$vo['goodsName']}</a></div>
				<div class="p-price">￥{$vo['shopPrice']}<span class="v-price">￥{$vo['marketPrice']}</span></div>
			</div>
			{/wst:goods}
		</div>
		<div class="hot-goods">
			<div class="title">热销商品</div>
			{wst:goods type='hot' cat="$catId" num='3'}
			<div class="item">
				<div class="img"><a target='_blank' href="{:Url('home/goods/detail','id='.$vo['goodsId'])}"><img class='goodsImg' data-original="__ROOT__/{:WSTImg($vo['goodsImg'])}" alt="{$vo['goodsName']}" title="{$vo['goodsName']}"/></a></div>
				<div class="p-name"><a class="wst-hide wst-redlink">{$vo['goodsName']}</a></div>
				<div class="p-price">￥{$vo['shopPrice']}<span class="v-price">￥{$vo['marketPrice']}</span></div>
			</div>
			{/wst:goods}
		</div>
	</div>
	<div class='goods-main'>
	   <div class='goods-filters'>
	   	  <div class='line'>
	        
	      </div>
	      <div class='line line2'>
	        <a class="condition {if condition="$orderBy eq 0"}curr {/if}" href='javascript:void(0)' onclick='javascript:goodsOrder(0)'>销量</a>
	        <a class="condition {$orderBy==1?'curr':''}" href='javascript:void(0)' onclick='javascript:goodsOrder(1)'>价格</a>
	        <a class="condition {$orderBy==2?'curr':''}" href='javascript:void(0)' onclick='javascript:goodsOrder(2)'>评论数</a>
	        <a class="condition {$orderBy==3?'curr':''}" href='javascript:void(0)' onclick='javascript:goodsOrder(3)'>人气</a>
	        <a class="condition {$orderBy==4?'curr':''}" href='javascript:void(0)' onclick='javascript:goodsOrder(4)'>上架时间</a>
	        <div class='chk'>
			 <div class="checkbox-box-s">
		     <input name='isStock' value='1' class="sipt wst-checkbox-s" onclick="goodsFilter(this,4)" type='checkbox' id="stock" {if $isStock==1}checked{/if}/>
		     <label for="stock"></label>
		     </div>
	                  显示有货</div>
	        <div class='chk'>
	         <div class="checkbox-box-s">
		     <input name='isNew' value='1' class="sipt wst-checkbox-s" onclick="goodsFilter(this,4)" type='checkbox' id="new" {if $isNew==1}checked{/if}/>
		     <label for="new"></label>
		     </div>
	                  新品</div>
        	<div class="wst-price-ipts">
			<span class="wst-price-ipt1">￥</span><span class="wst-price-ipt2">￥</span>
			<input type="text" class="sipt wst-price-ipt" id="sprice" value="{$sprice}" style="margin-left:8px;" onkeypress='return WST.isNumberdoteKey(event);' onkeyup="javascript:WST.isChinese(this,1)">
			- <input type="text" class="sipt wst-price-ipt" id="eprice" value="{$eprice}" onkeypress='return WST.isNumberKey(event);' onkeyup="javascript:WST.isChinese(this,1)">
			</div>
			<button class="wst-price-but" type="submit" style="width:60px;height: 25px;" onclick='javascript:goodsOrder()'>确定</button>
	      </div>
	   </div>
	   <div class="goods-list">
	      {volist name='goodsPage["Rows"]' id='vo'}
	      <div class="goods">
	      	<div class="img"><a target='_blank' href="{:Url('home/goods/detail','id='.$vo['goodsId'])}"><img title="{$vo['goodsName']}" alt="{$vo['goodsName']}" class='goodsImg2' data-original="__ROOT__/{$vo['goodsImg']}"/></a></div>
	      	<div class="p-name"><a target='_blank' href="{:Url('home/goods/detail','id='.$vo['goodsId'])}" class="wst-redlink" title="{$vo['goodsName']}">{$vo['goodsName']}</a></div>
	      	<div>
	      		<div class="p-price">￥{$vo['shopPrice']}</div>
	      		<div class="p-hsale">
	      			<div class="sale-num">成交数：<span class="wst-fred">{$vo['saleNum']}</span></div>
		      		<a class="p-add-cart" style="display:none;" href="javascript:WST.addCart({$vo['goodsId']});">加入购物车</a>
	      		</div>
	      		<div class='wst-clear'></div>
	      	</div>
	      	<div>
	      		<div class="p-mprice">市场价<span>￥{$vo['marketPrice']}</span></div>
	      		<div class="p-appraise">已有<span class="wst-fred">{$vo['appraiseNum']}</span>人评价</div>
	      		<div class='wst-clear'></div>
	      	</div>
	      </div>
	      
	      {/volist}
	     <div class='wst-clear'></div>
	   	</div>
	   	<div style="position: absolute;bottom: -50px;width:980px;">
	  		<div id="wst-pager"></div>
		</div>
		
	</div>
	<div class='wst-clear'></div>
</div>
{include file="default/right_cart"/}
{/block}
{block name="js"}
<script type='text/javascript' src='__STYLE__/js/goodslist.js?v={$v}'></script>
<script type='text/javascript'>
laypage({
    cont: 'wst-pager',
    pages: {$goodsPage["TotalPage"]}, //总页数
    skip: true, //是否开启跳页
    skin: '#e23e3d',
    groups: 3, //连续显示分页数
    curr: function(){ //通过url获取当前页，也可以同上（pages）方式获取
        var page = location.search.match(/page=(\d+)/);
        return page ? page[1] : 1;
    }(), 
    jump: function(e, first){ //触发分页后的回调
        if(!first){ //一定要加此判断，否则初始时会无限刷新
        	var nuewurl = WST.splitURL("page");
        	var ulist = nuewurl.split("?");
        	if(ulist.length>1){
        		location.href = nuewurl+'&page='+e.curr;
        	}else{
        		location.href = '?page='+e.curr;
        	}
            
        }
    }
});



var total = {$goodsPage["TotalPage"]};
function page(t){
	var page = location.search.match(/page=(\d+)/);
	var curr = 1;
	if(page && page.length>1){ //说明当前url上有page参数
		curr = page[1]; // 当前页
	}
	var nuewurl = WST.splitURL("page"); // 当前url
	var ulist = nuewurl.split("?"); // 将传递的参数与url分开
	// 说明当前有参数. 需要带着参数一起传递
	var url = (ulist.length>1)?nuewurl+'&page=':'?page=';

	if(t=='prev'){ // 上一页
		if(curr<=1)return;
		curr = parseInt(curr)-1;
		location.href = url+curr;
	}else{ // 下一页
		if(curr>=total)return;
		curr = parseInt(curr)+1;
		location.href = url+curr;
	}
	
}
</script>
{/block}
